<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<meta charset="UTF-8" />
<title>【顺风车】 - 车主管理</title>
<link rel="stylesheet" href="../../static/assets/css/amazeui.css" th:href="@{/assets/css/amazeui.min.css}" />
<link rel="stylesheet" href="../../static/assets/css/amaze.min.css" th:href="@{/assets/css/amaze.min.css}" />
<link rel="stylesheet" href="../../static/assets/css/common.min.css" th:href="@{/assets/css/common.min.css}" />
<link rel="stylesheet" href="../../static/assets/css/other.min.css" th:href="@{/assets/css/other.min.css}" />
<link rel="stylesheet" href="../../static/assets/css/app2.css" th:href="@{/assets/css/app2.css}" />
<script th:inline="javascript">
	var r = [[${r}]];
	var totalPages = [[${page.totalPages}]];
</script>
</head>
<body class="register-container">
	<div th:include="common/header::header"></div>

	<br />
	<!--===========layout-container================-->
	<div class="am-container" style="background: #fff;">

		<div class="tpl-page-container tpl-page-header-fixed">

			<div th:include="common/nav::nav"></div>


			<div class="tpl-content-wrapper">

				<div class="row">
					<div class="tpl-portlet">
						<div class="tpl-portlet-title">
							<div class="tpl-caption font-green ">
								<span>车主管理</span>
							</div>
						</div>

						<table class="am-table am-table-compact am-table-centered">
							<thead>
								<tr>
									<th class="am-text-middle am-text-sm" width="50">序号</th>
									<th class="am-text-middle am-text-sm">用户名</th>
									<th class="am-text-middle am-text-sm">姓名</th>
									<th class="am-text-middle am-text-sm" width="100">性别</th>
									<th class="am-text-middle am-text-sm" width="100">年龄</th>
									<th class="am-text-middle am-text-sm" width="100">状态</th>
									<th class="am-text-middle am-text-sm" width="50">操作</th>
								</tr>
							</thead>
							<tbody>
								<tr th:each="user,s : ${page.content}">
									<th class="am-text-middle am-text-xs" th:text="${s.index + 1}">index</th>
									<td class="am-text-middle am-text-xs" th:text="${user.username}"></td>
									<td class="am-text-middle am-text-xs" th:text="${user.realName}"></td>
									<td class="am-text-middle am-text-xs" th:text="${user.sexName}"></td>
									<td class="am-text-middle am-text-xs" th:text="${user.age}"></td>
									<td class="am-text-middle am-text-xs">
										<span class="am-badge am-round am-badge-success" th:text="${user.userStateName}"
											th:if="${user.userState.toString()=='ENABLED'}"></span>
										<span class="am-badge am-round am-badge-danger" th:text="${user.userStateName}"
											th:if="${user.userState.toString()=='DISABLED'}"></span>
										<span class="am-badge am-round am-badge-secondary" th:text="${user.userStateName}"
											th:if="${user.userState.toString()=='PENDING'}"></span>
										<span class="am-badge am-round am-badge-warning" th:text="${user.userStateName}"
											th:if="${user.userState.toString()=='FINISHED'}"></span>
									</td>
									<td class="am-text-middle am-text-xs">
										<div class="am-btn-toolbar">
											<div class="am-btn-group am-btn-group-xs">
												<a th:if="${user.userState.toString()=='PENDING'}" th:href="@{'/front/user/driver/'+${user.id}}"
													class="am-btn am-btn-default am-btn-xs finished"> 完成 </a>
												<a th:if="${user.userState.toString()=='FINISHED'}" th:href="@{'/front/user/driver/'+${user.id}}"
													class="am-btn am-btn-default am-btn-xs pending"> 待定 </a>
											</div>
										</div>
									</td>
								</tr>
							</tbody>
						</table>
						<div id="page"></div>

					</div>
				</div>
			</div>
		</div>
	</div>
	<br />

	<div th:include="common/footer::footer"></div>

	<script src="../../static/assets/js/jquery-2.1.0.js" charset="utf-8" th:src="@{/assets/js/jquery-2.1.0.js}"></script>
	<script src="../../static/assets/js/amazeui.js" charset="utf-8" th:src="@{/assets/js/amazeui.js}"></script>
	<script src="../../static/assets/layer/layer.js" charset="utf-8" th:src="@{/assets/layer/layer.js}"></script>
	<script src="../../static/assets/laypage/laypage.js" charset="utf-8" th:src="@{/assets/laypage/laypage.js}"></script>
	<script src="../../static/assets/js/core.js" charset="utf-8" th:src="@{/assets/js/core.js}"></script>
</body>
<script type="text/javascript">
	if (r) {
		if (r.code == 0) {
			layer.msg(r.message, {
				icon : 1
			});
		} else {
			layer.msg(r.message, {
				icon : 2
			});
		}
	}

	$(".pending").confirmOperator({
		msg : "确定要修改状态吗？"
	});
	
	$(".finished").confirmOperator({
		msg : "确定要修改状态吗？"
	});

	laypage({
		cont : 'page',
		pages : totalPages,
		curr : function() {
			var page = location.search.match(/page=(\d+)/);
			return page ? page[1] : 1;
		}(),
		jump : function(e, first) {
			if (!first) {
				location.href = '?page=' + e.curr;
			}
		}
	});
</script>
</html>
